package com.sz.common.core.system.service.impl;

import com.sz.common.core.system.entity.SysDict;
import com.sz.common.core.system.service.SysDictService;
import com.sz.common.core.system.service.UserPositionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Function: TODO: ADD FUNCTION <br>
 * Author: Charles. <br>
 * Date: 2017-05-05 14:54:00.
 */
@Service
public class UserPositionServiceImpl implements UserPositionService {
    @Autowired
    private SysDictService dictService;

    @Override
    public String getNameByCode(String code) {
        List<SysDict> dictList = dictService.findByCatalog("sys.user.position");
        if (dictList != null && dictList.size() > 0) {
            for (SysDict dict : dictList) {
                if (dict.getCode().equals(code)) {
                    return dict.getName();
                }
            }
        }
        return null;
    }
}
